
const TransformPages = require('uni-read-pages')
const {webpack} = new TransformPages()

// 处理:分包后直接引入static静态资源中图片，提示找不到
const path = require('path')
// const CopyWebpackPlugin = require('copy-webpack-plugin')

module.exports = {
	devServer: {
		port: 8099,  // 确保是数字
	    // allowedHosts: "all", // 允许所有 Host
	    // 或指定允许的域名/IP：
	    // allowedHosts: ['.example.com', '192.168.1.100']
	},
	configureWebpack: {
		plugins: [
			new webpack.DefinePlugin({
				ROUTES: webpack.DefinePlugin.runtimeValue(() => {
					const tfPages = new TransformPages({
						includes: ['path', 'name', 'aliasPath','meta']
					});
					return JSON.stringify(tfPages.routes)
				}, true )
			}),
			// new CopyWebpackPlugin([
			// 	{
			// 	  from: path.join(__dirname, '/static'),
			// 	  to: path.join(__dirname+'/unpackage/', 'dist', process.env.NODE_ENV === 'production' ? 'build' : 'dev', process.env.UNI_PLATFORM, '/')  
			// 	}
			// ])
		]
	}  
}    
                        